//
//  GAKKIBaseModel.m
//  GANGAIKit
//
//  Created by fh on 2019/11/6.
//  Copyright © 2019 cashchina. All rights reserved.
//

#import "GAKKIBaseModel.h"
#import <objc/runtime.h>

@implementation GAKKIBaseModel
- (void)dealloc {
    if (kDebugModelRelease) {
        DBLog(@"\n +++++++++++ 模型 %@ 销毁了 +++++++++++ \n",[self class])
    }
}

#pragma mark - Public

/// 获取所有属性
- (NSArray<NSString *> *)getAllProperties {
    u_int count = 0;
    //传递count的地址
    objc_property_t *properties = class_copyPropertyList([self class], &count);
    NSMutableArray *propertyArray = [NSMutableArray arrayWithCapacity:count];
    for (int i = 0; i < count; i++) {
        //得到的propertyName为C语言的字符串
        const char *propertyName = property_getName(properties[i]);
        [propertyArray addObject:[NSString stringWithUTF8String:propertyName]];
    }
    free(properties);
    return propertyArray;
}

/*
+ (NSDictionary *)modelCustomPropertyMapper {
return @{@"identifying" : @"id"};
}
+ (NSDictionary *)modelContainerPropertyGenericClass {
return @{ @"message" : [MessageModel class],
@"banner" : [BannerModel class],
@"products" : [HomeProductModel class]
};
}
//*/

@end
